<html>
<head>
<title>dynamically inserted control with "autofocus" set</title>
<style>
 input { background:red }
 input:focus { background:lime }
</style>
<script src="resources/common.js"></script>
<script language="JavaScript" type="text/javascript">
    function log(message) {
        document.getElementById("console").innerHTML += "<li>"+message+"</li>";
    }

    function test() {
        if (window.testRunner)
            testRunner.dumpAsText();
            
        if (document.activeElement == document.getElementsByTagName("input")[0])
            log("SUCCESS");
        else
            log("FAILURE");
        if (window.testRunner)
            testRunner.notifyDone();
    }

    waitUntilLoadedAndAutofocused(test);
</script>
</head>
<body>
<p>FAIL (The script did not run.)</p>
<script>
 document.getElementsByTagName('p')[0].innerHTML = "This form control should have a green background: <input autofocus>";
</script>
<hr>
<ol id="console"></ol>
</body>
</html>
